#ifndef WF_EXPRESSION_H
#define WF_EXPRESSION_H

#include "bindings/binding.h"
#include "expressions/expressioncommon.h"
#include "types/wfnettypes.h"

#include <iexpression.h>

#include <QtCore/QObject>
#include <QtCore/QSet>

using namespace core;
using namespace net;

namespace wfnet
{
class WfNet;

class Expression : public QObject, /*implements*/public IExpression
{
    Q_OBJECT

public:
    ~Expression();

    // IIdentifiable
    nid getId() const;

    // IExpression
    const core::TypeName returns() const;
    core::Type* eval();

    void setBinding(const Binding& binding);
    void clearBinding();
    uint getExpressionType() const;
    UserVariables getUserVariables() const;

protected:
    Expression(WfNet* parent, nid id, const Expr& expr,
        const TypeName& returnedType,
        const UserVariables& variables,
        const SystemVariables& systemVariables,
        uint exprType);

private:
    friend class WfNet;

    nid m_id;
    Expr m_expression;
    TypeName m_returnedType;
    Binding m_binding;
    UserVariables m_variables;
    SystemVariables m_systemVariables;
    uint m_expressionType;
};

} // namespace wfnet

#endif
